import java.util.Scanner;

public class Test {
    //依次打印各个数位的数字
    public static void iprint(int n){
        if (n < 10){
            System.out.print(n+" ");
            return;//结束这个方法的调用
        }
        iprint(n/10);
        System.out.print(n%10+" ");

    }
    public static void main(String[] args) {
        iprint(1243656);

    }




















    //求出数字的各项数位的值的和
    public static int sum(int n){
        if(n > 0 && n <10){
            return n;
        }
        return n%10 + sum(n/10);
    }
    public static void main7(String[] args) {
        System.out.println(sum(123));

    }












    //递归实现求斐波那契数列的第N项
    public static int fbl(int n){
        if (n == 1){
            return 0;
        }
        else if (n == 2){
            return 1;
        }
        else {
            return fbl(n-1)+fbl(n-2);
        }
    }
    public static void main6(String[] args) {
        System.out.println(fbl(40));
    }













    //递归实现汉诺塔
    public static void move(char pos1,char pos2){//char只能存放单引号括起的一个字符
        System.out.print(pos1+"->"+pos2+" ");
    }
    public static void hanio(int n,char pos1,char pos2,char pos3){
        //递归的思想：直接从最简单的算起，慢慢复杂，然后找到规律，循环表达即可
        if (n == 1){
            move(pos1,pos3);
        }
        else {
            hanio(n-1,pos1,pos3,pos2);
            move(pos1,pos3);
            hanio(n-1,pos2,pos1,pos3);
        }
    }
    public static void main5(String[] args) {
        hanio(1,'A','B','C');
        System.out.println();
        hanio(2,'A','B','C');
        System.out.println();
        hanio(3,'A','B','C');



    }









    public static int jumpFrog(int tep){
        if (tep == 1){
            return 1;
        }
        else if (tep == 2){
            return 2;
        }
        return jumpFrog(tep-1)+jumpFrog(tep-2);
    }
    public static void main4(String[] args) {

        //青蛙跳台阶

        Scanner in = new Scanner(System.in);
        int tep = in.nextInt();
        System.out.println(jumpFrog(tep));

    }
    public static int sum(int a,int b){
        return a+b;
    }
    public static double sum(double a,double b,double c){
        return a+b+c;
    }
    public static void main3(String[] args) {
        //方法重载求和
        int a=10;
        int b=20;
        double c = 10.0;
        double d=20.0;
        double e=30.0;
        System.out.println(sum(a,b));
        System.out.println(sum(c,d,e));

    }
    public static int max(int a,int b) {
        return Math.max(a,b);
    }

    public static int max(int a,int b,int c) {

        int m = Math.max(a,b);
        return Math.max(m,c);
    }
    public static int max1(int a,int b){
        return a>b?a:b;
    }
    public static int max2(int a,int b){
        return max1(a,b)>b?max1(a,b):b;
    }
    public static void main2(String[] args) {
        int a = 10;
        int b = 20;
        System.out.println(max(a,b));
    }
}
